Skip to content

feature-flags: request required scopes by default | DAL-929 - #695

Merged
platinummonkey merged 2 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/feature-flags-scopes
Jul 29, 2026
Merged

feature-flags: request required scopes by default | DAL-929#695
platinummonkey merged 2 commits into
DataDog:mainfrom
srosenthal-dd:stephen.rosenthal/feature-flags-scopes

Conversation

@srosenthal-dd

@srosenthal-dd srosenthal-dd commented Jul 28, 2026

Copy link
Copy Markdown
Member

Fixes #679, together with a server-side update

Summary

pup feature-flags flags list (and all other feature-flags operations) fails with 403 Forbidden / "Failed permission authorization checks" after the server-side OAuth fix for this command group deployed. Root cause: pup was never requesting any feature_flag_* scope at login, so the OAuth token it has simply doesn't carry the required permissions -- a scope-request gap, not a route-auth gap.

Scope check

Five distinct permissions are used across this command group, all already public/grantable OAuth scopes:

Permission Used by
feature_flag_config_read list/get flags, list allocations
feature_flag_config_write create/update/archive/unarchive/delete flags, enable/disable, allocations, exposure schedules
feature_flag_environment_config_read paired with most flag read/write routes, list/get environments
feature_flag_environment_config_write create/update/delete environments
feature_flag_approvals_override require-approval

None of these were in default_scopes() or read_only_scopes() before this PR. Adds all 5 to default_scopes() (consistent with other write-capable-but-not-especially-sensitive scopes already there, e.g. org_management, teams_manage), and the two read scopes to read_only_scopes().

Test plan

  • cargo test default_scopes passes
  • CI passes
  • Manually verify pup feature-flags flags list succeeds after pup auth login (fresh login required to pick up newly-requested scopes)

Jira: DAL-929

pup feature-flags flags list (and all other feature-flags operations) was
failing OAuth permission checks with 403 Forbidden because none of the
feature_flag_* scopes were requested at login. Adds all 5 permissions
used across the public API (config/environment read+write,
approvals_override) to default_scopes(), and the two read scopes to
read_only_scopes(). Documents the requirement in the command help text.
@srosenthal-dd
srosenthal-dd marked this pull request as ready for review July 29, 2026 05:07
@srosenthal-dd
srosenthal-dd requested a review from a team as a code owner July 29, 2026 05:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7aa242ba18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/auth/types.rs Outdated
Comment thread src/auth/types.rs Outdated
Comment thread src/main.rs Outdated
Comment thread src/main.rs Outdated
…dd tests

- Removed feature_flag_approvals_override from default_scopes(): no pup
  command exposes require-approval, so this granted an unnecessary
  approval-bypass permission for no reason.
- Rewrote the AUTHENTICATION help text to describe per-operation scope
  requirements accurately instead of implying every operation needs a
  config+environment scope pair (environments list/get/create/update/delete
  only need the environment scope alone).
- Added test_default_scopes_feature_flags and
  test_read_only_scopes_feature_flags asserting the exact scope sets,
  since the existing generic scope tests didn't reference any
  feature_flag_* name and would still pass if they were wrong.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3034927f6a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main.rs
@platinummonkey
platinummonkey merged commit ad158b6 into DataDog:main Jul 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Can't fetch feature flag configs via pup

2 participants